package com.siemens.industrial.model.admin;

import org.springframework.jdbc.core.RowMapper;

import java.util.Date;

/**
 * Created by weig on 8/23/16.
 */
public class Tenant {
    private String tenantId;
    private String tenantKey;
    private String tenantName;
    private String password;
    private int enabled;
    private String address;
    private String contact;
    private String telephone;
    private String managerEmail;
    private String logoMd5;
    private String description;
    private Date createTime;
    private static final RowMapper<Tenant> rowMapper = (resultSet, i) -> {
        Tenant tenant = new Tenant();
        tenant.setTenantId(resultSet.getString("tenant_id"));
        tenant.setTenantKey(resultSet.getString("tenant_key"));
        tenant.setTenantName(resultSet.getString("tenant_name"));
        tenant.setPassword(resultSet.getString("password"));
        tenant.setEnabled(resultSet.getInt("enabled"));
        tenant.setAddress(resultSet.getString("address"));
        tenant.setContact(resultSet.getString("contact"));
        tenant.setTelephone(resultSet.getString("telephone"));
        tenant.setManagerEmail(resultSet.getString("manager_email"));
        tenant.setLogoMd5(resultSet.getString("logo_md5"));
        tenant.setDescription(resultSet.getString("description"));
        tenant.setCreateTime(new Date(resultSet.getTimestamp("create_time").getTime()));
        return tenant;
    };

    public static RowMapper<Tenant> getRowMapper() {
        return rowMapper;
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    public String getTenantKey() {
        return tenantKey;
    }

    public void setTenantKey(String tenantKey) {
        this.tenantKey = tenantKey;
    }

    public String getTenantName() {
        return tenantName;
    }

    public void setTenantName(String tenantName) {
        this.tenantName = tenantName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getEnabled() {
        return enabled;
    }

    public void setEnabled(int enabled) {
        this.enabled = enabled;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getContact() {
        return contact;
    }

    public void setContact(String contact) {
        this.contact = contact;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getManagerEmail() {
        return managerEmail;
    }

    public void setManagerEmail(String managerEmail) {
        this.managerEmail = managerEmail;
    }

    public String getLogoMd5() {
        return logoMd5;
    }

    public void setLogoMd5(String logoMd5) {
        this.logoMd5 = logoMd5;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
